Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require_field_match now defaults to true #11067

Conversation

javanna
Copy link
Member

@javanna javanna commented May 8, 2015

The default false for require_field_match is a bit odd and confusing for users, given that field names get ignored by default and every field gets highlighted if it contains terms extracted out of the query, regardless of which fields were queried. Changed the default to true, it can always be customized per request.

Closes #10627

The default `false` for `require_field_match` is a bit odd and confusing for users, given that field names get ignored by default and every field gets highlighted if it contains terms extracted out of the query, regardless of which fields were queries. Changed the default to `true`, it can always be changed per request.

Closes elastic#10627
@nik9000
Copy link
Member

nik9000 commented May 8, 2015

+1

I'm so glad this is built in and doesn't have to happen 4 times....

@johtani
Copy link
Contributor

johtani commented May 9, 2015

@javanna I left some comment.

@@ -1914,8 +1879,8 @@ public void testPostingsHighlighter() throws Exception {

logger.info("--> searching on _all, highlighting on field1");
source = searchSource()
.query(termQuery("_all", "test"))
.highlight(highlight().field("field1").preTags("<xxx>").postTags("</xxx>"));
.query(termQuery("field1", "test"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the field name to "field1"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because if we keep _all and highlight field1 there we get no output back. I didn't rely on requireFieldMatch for this one as the postings highlighter is soon not going to support it anymore, see #11077

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Then, I think we should change the log message from searching on _all to searching on field1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will do!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review Jun I changed this test to leave querying for _all and set require_field_match to false explicitly. Will change again when #11077, doesn't make much sense to take it into account here.

@javanna
Copy link
Member Author

javanna commented May 12, 2015

@clintongormley you ok with this change?

@rmuir
Copy link
Contributor

rmuir commented May 15, 2015

looks good

@clintongormley
Copy link

@javanna +1

@javanna javanna removed the review label May 15, 2015
@javanna javanna closed this in a843008 May 15, 2015
@clintongormley clintongormley changed the title Highlighting: require_field_match set to true by default require_field_match now defaults to true Jun 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Highlighting: require_field_match on by default
5 participants